package com.csdj.springboottest.mapper;

import com.csdj.springboottest.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * author:cloud
 * date:2021/4/21 0021
 **/
public interface UserMapper {


    List<User> findAll();

    User findById(int id);

    int update(User user);

    @Mapper
    @Select("select * from user where username = #{username}")
    User findByUsername(String username);

    @Mapper
    @Select("select * from user where username = #{username} and password = #{password}")
    User login(@Param("username")String username,@Param("password")String password);
}
